The I2C bus is a bi-directional 2-wire bus used for inter-IC communication. A master device controls the data transfer with one single slave device out of a maximum of 1024 slave devices at a time. The limitation of the maximum number or slave devices is a consequence of the size of the address field (10 bits) defined by the I2C bus standard. The individual device addresses are stipulated in the I2C bus standard and provide a means to unambiguously identify the devices.
EEPROMs (acronym for: Electric Erasable and Programmable Read Only Memory) are widely used to store programs or data in appliances and devices, where the information stored must be retained even when no power is available. A number of EEPROM devices are readily available which use the I2C bus interface for reading and writing data. Access to the EEPROM content following the I2C bus standard has to be sequential. Some EEPROM manufacturers use proprietary mechanisms that let the master device randomly access up to one memory page (128 bytes) of an EEPROM. However, the size of embedded EEPROM memory, e.g., in ASICs (acronym for: Application Specific Integrated Circuit) and FPGAs (acronym for: Field Programmable Gate Array) has increased significantly and randomly accessing the contents of this memory through the I2C bus is difficult to handle due to the address space limitation stipulated in the standard.
The physical layer of the I2C bus generally consists of two wires interconnecting all devices in a parallel manner. The serial data line (SDA) carries the data to be transmitted in a serial manner, and the serial clock (SCL) provides the clock signals and determines the data rate. Each clock cycle allows for one single bit to be transferred. The START and STOP condition of a connection is established by predetermined logic levels on both lines. A master device is the device which initiates a data transfer on the bus, generates the clock signals for the current connection and terminates the transfer. A slave device is the device addressed by a master. Each device is recognized by a unique address and may operate as either a transmitter or a receiver. A transmitter is the device which sends data to the bus. A receiver is the device which receives data from the bus. In the following description, the logic levels on the I2C bus are referred to as ‘high’ and ‘low’ or ‘1’ and ‘0’, respectively. The absolute levels of the I2C bus signals may vary depending on the application. Due to the bi-directional nature of the I2C bus, the input and output ports of the devices must be tri-state ports. Tri-state ports may actively assume high or low levels at a low impedance for transmitting, or represent a high impedance to the bus for receiving data. In standby or unused state, the clock and data lines are pulled to a predetermined level by appropriate biasing means and all devices connected to the bus represent a high impedance to the bus. A START condition is established by a high-to-low transition of the data line (SDA) while the clock line (SCL) remains in a high state. A START condition must always precede any command for data transfer. A STOP condition is established by a low-to-high transition of the data line (SDA) while the clock line (SCL) remains high. A STOP condition terminates the communication between the bus master and the slave. A successful data transfer is indicated by an acknowledge signal (ACK) generated by the receiving device. In order to do so, the transmitting device, either master or slave, depending on the direction of data transfer, releases the SDA line after transmitting 8 bits of data, i.e., the device port assumes a high impedance. During the 9th clock pulse the receiver actively pulls the SDA wire low to acknowledge the receipt of 8 bits of data. Any further error correction is to be implemented separately in the devices and is not part of the I2C bus protocol. The receiving device samples the SDA line on the rising edge of the clock SCL signal. The SDA signal must be stable during the low to high transition of the clock SCL and the data on the SDA line must change only when the SCL line is low. A master device can initiate data transfer with a slave device by establishing a START condition.
In the following the general addressing scheme of an I2C device according to the standard for 7-bit addressing is presented. The 10-bit addressing also available is more complex but essentially similar and will therefore not be referred to in detail. After the START condition is established, the master sends a slave address on the SDA line. The slave address is composed of 8 bits: the 7 most significant make up the slave address, as stipulated in the I2C bus standard, the 8th bit or least significant bit LSB is the read or write bit (R/ W), which is set to ‘1’ for a read operation and to ‘0’ for a write operation. If the slave device identifies a match between the address sent on the SDA line and its own assigned address, it generates an acknowledge signal on the SDA wire during the 9th bit cycle.
The data transfer of a general write operation follows the scheme shown in FIG. 1. In the figure, the transmission from master to slave is indicated by a shaded background, and the transmission from slave to master is indicated by a white background. A master device generates the START condition S, subsequently transmits a slave address with the R/ Wbit set to ‘0’, ‘n’ bytes of data, and finally generates the STOP condition P. The slave device generates an acknowledge signal A during the 9th clock pulse after each received byte of data.
The data transfer for a general read operation follows the scheme shown in FIG. 2. Again, a master device generates a START condition S. Then the master device transmits the slave address with the R/ W bit set to ‘1’ and puts its SDA port in high impedance state for receiving. The addressed slave now sends ‘n’ bytes of data. While the master is transmitter, the slave device generates an acknowledge signal A during the 9th clock pulse after each received byte of data. While the slave is transmitter, the master generates an acknowledge signal A during the 9th clock pulse after each received byte of data. The transfer is terminated when the master generates a STOP condition P.
However, the I2C protocol as stipulated in the standard is limited to sequential read and write operations, and random access is not possible. When addressing a memory, e.g., an EEPROM, the memory needs not only to identify that it was selected, but it also needs information about which memory cell is to be read or written. This may in the current standard be accomplished by a combined read/write operation, wherein during the write operation the EEPROM receives the address to be read and in a subsequent read operation, the memory cell is read. However, this procedure requires the bus master to issue a first START condition, to address the slave for writing, transfer the cell address, then to issue a second START condition, and finally re-address the device for reading. Every single byte has to be addressed individually. This reduces the actual transfer speed of the I2C bus compared to the theoretical value, since some overhead of addressing operations is necessary. If several devices are connected to the bus, bus arbitration may additionally interfere with the need for fast transfer. Arbitration is a procedure to ensure that, if more than one master simultaneously try to control the bus, only one is allowed to do so, thereby ensuring that messages are not corrupted. Some EEPROM manufacturers use a proprietary combination of write and read operations in order to render random access to an EEPROM possible, but these schemes are limited to small address spaces, e.g. 128 bytes.
Application Note AN736 of Microchip Technology Inc. discloses an I2C network protocol which is used for environmental monitoring. The network protocol suggests using a single data length byte, indicating the number of data bytes to be written or read, and a single address offset byte, indicating the slave's memory address to be read or written.
It is, therefore, desirable to provide a method for addressing cells inside a slave device, which allows for true random access.